﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;

[assembly: CommandClass(typeof(Hello.CmdHello))]
namespace Hello
{
    public class CmdHello
    {
        // [CommandMethod("UcdCmdGp", "Hello1", "hi1", CommandFlags.UsePickSet)]
        //[CommandMethod("UcdCmdGp", "Hello1", "hi1", CommandFlags.UsePickSet)]
        [CommandMethod("HelloArx", CommandFlags.UsePickSet)]
        public static void DoIt()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            try
            {
                ed.WriteMessage("Hello命令执行\n");
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                ed.WriteMessage(ex.ToString());
            }
        }


        /*
        无法加载程序集。错误详细信息: System.Resources.MissingManifestResourceException: 未能找到任何适合于指定的区域性或非特定区域性的资源。请确保在编译时已将“Hello.CmdHello.resources”正确嵌入或链接到程序集“Hello”，或者确保所有需要的附属程序集都可加载并已进行了完全签名。
        在 System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
        在 System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
        在 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
        在 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
        在 System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
        在 Autodesk.AutoCAD.Runtime.CommandClass.AddCommand(ICommandLineCallable ca, MethodInfo mi)
        在 Autodesk.AutoCAD.ApplicationServices.AutoCADApplicationHolder.Initialize(Assembly assembly)
        在 Autodesk.AutoCAD.ApplicationServices.ExtensionLoader.ProcessAssembly(Assembly assembly)*/
    }
}